import Vue from 'vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter);
import Index from '@/views/Index.vue'
import More from '@/views/More.vue'
import Orderlist from '@/views/Orderlist.vue'
import Login from '@/views/Login.vue'
import Shop from '@/views/Shop.vue'
// import Site from'@/views/Site.vue'
import NProgress from 'nprogress'; "../../node_modules/nprogress/nprogress.js"
import "../../node_modules/nprogress/nprogress.css"
import GoodsDetail from '@/views/GoodsDetail.vue'
import Goodslist from '@/views/Goodslist.vue'
// import Scroll from "@/views/Scroll.vue"
import vantscroll from "@/views/vantscroll.vue"
//import Newslist from '@/views/Newslist.vue'
// import NewsDetail from'@/views/NewsDetail.vue'
const router = new VueRouter({
    routes: [
        // 
        { path: "/", redirect: "/Index" },
        {
            path: "/index",
            component: Index,
            meta: {
                pageTitle: "首页",
                // mainPage:false不显示标题
                mainPage: false,
                isshowTitle: false,
                isTabBar: true,
            }
        },
        {
            path: "/more", component: More,
            meta: {
                pageTitle: "更多",
                mainPage: false,
                isshowTitle: false,
                isTabBar: true,
            }
        },
        {
            path: "/orderlist", component: Orderlist,
            meta: {
                pageTitle: "订单列表",
                mainPage: false,
                isshowTitle: false,
                isTabBar: true,
            }
        },
        {
            path: "/login", component: Login,
            meta: {
                pageTitle: "七海个人中心",
                mainPage: false,
                isshowTitle: false,
                isTabBar: true,
            }
        },
        {
            path: "/shop", component: Shop,
            meta: {
                pageTitle: "购物车",
                mainPage: false,
                isshowTitle: false,
                isTabBar: true,
            }
        },
        // {
        //     path: "/Site", component: Site,
        //     meta: {
        //         pageTitle: "我的地址",
        //         mainPage:true,
        //         isshowTitle:true,
        //         isTabBar:false,
        //     }
        // },
        {
            path: "/GoodsDetail/:id", component: GoodsDetail,
            props: true,
            meta: {
                pageTitle: "商品详情",
                mainPage: true,
                isshowTitle: true,
                isTabBar: false,
            }
        },
        {
            path: "/Goodslist", component: Goodslist,
            props: true,
            meta: {
                pageTitle: "商品列表",
                mainPage: true,
                isshowTitle: true,
                isTabBar: false,
            }
        },
        {
            path: "/Vantscroll",
            component: vantscroll,
            meta: {
                // pageTitle:"better-scroll",
                pageTitle: "vant-scroll",
                mainPage: true,
                isshowTitle: true,
                isTabBar: false,
            }

        },
        {
            path: "/newslist",
            component: () => import('@/views/Newslist.vue'),
            meta: {
                pageTitle: "新闻列表",
                mainPage: true,
                isshowTitle: true,
                isTabBar: false,
            }
        },
        {
            path: "/newsdetail/:id",
            component: () => import('@/views/NewsDetail.vue'),
            props: true,
            meta: {
                pageTitle: "新闻详情",
                mainPage: true,
                isshowTitle: true,
                isTabBar: false,
            }
        },
        {
            path: "/register",
            component: () => import('@/views/Register.vue'),
            props: true,
            meta: {
                pageTitle: "用户注册",
                mainPage: false,
                isshowTitle: false,
                isTabBar: true,
            }
        },
    ]
})

NProgress.configure({
    showSpinner: false
})
router.beforeEach((to, from, next) => {
    // ...
    NProgress.start();
    next()
})
router.afterEach((to, from) => {
    // ...
    NProgress.done();
})
//暴露，导出路由
export default router;